window = global;
// 过toString检测的方法//func_set_native用于保护
(() => {
    "use strict";
    const $toString = Function.toString();
    const myFunction_toString_symbol = Symbol('('.concat('',')_', (Math.random() + '').toString(36)));
    const myToString = function(){
        return typeof this == 'function' && this[myFunction_toString_symbol] || $toString.call(this);
    };
    function set_native(func, key, value){
        Object.defineProperty(func, key, {
            "enumerable": false,
            "configurable": true,
            "writable": true,
            "value": value
        })
    };
    delete Function.prototype['toString']; // 删除原型链上的toString
    set_native(Function.prototype, "toString", myToString); // 自己定义个getter方法
    set_native(Function.prototype.toString, myFunction_toString_symbol, "function toString() { [native code] }"); // 套个娃 保护一下我们定义的toString 否则就暴露了
    globalThis.func_set_native = (func) => {
        set_native(func, myFunction_toString_symbol, `function ${myFunction_toString_symbol,func.name || ''}() { [native code] }`);
    }; // 导出函数到globalThis
    }).call(globalThis);
XMLHttpRequest = function XMLHttpRequest(){};func_set_native(XMLHttpRequest);
XMLHttpRequest.prototype.send = function send(){};func_set_native(XMLHttpRequest);
//代理
function getEnvs(proxyObjs) {
    for (let i = 0; i < proxyObjs.length; i++) {
        const handler = `{
      get: function(target, property, receiver) {
        console.log("方法:", "get  ", "对象:", "${proxyObjs[i]}", "  属性:", property, "  属性类型：", typeof property, ", 属性值：", target[property], ", 属性值类型：", typeof target[property]);
        return target[property];
      },
      set: function(target, property, value, receiver) {
        console.log("方法:", "set  ", "对象:", "${proxyObjs[i]}", "  属性:", property, "  属性类型：", typeof property, ", 属性值：", value, ", 属性值类型：", typeof target[property]);
        return Reflect.set(...arguments);
      }
    }`;
        eval(`try {
            ${proxyObjs[i]};
            ${proxyObjs[i]} = new Proxy(${proxyObjs[i]}, ${handler});
        } catch (e) {
            ${proxyObjs[i]} = {};
            ${proxyObjs[i]} = new Proxy(${proxyObjs[i]}, ${handler});
        }`);
    }
}
proxyObjs = ['window', 'document', 'location', 'navigator','history','screen','localStorage','sessionStorage']
// 开启环境代理
getEnvs(proxyObjs);
require("./bdms.js")
t = {
    "aid": 6383,
    "pageId": 6241,
    "paths": [
        "^/webcast/",
        "^/aweme/v1/",
        "^/aweme/v2/",
        "/v1/message/send",
        "^/live/",
        "^/captcha/",
        "^/ecom/"
    ],
    "boe": false,
    "ddrt": 8.5,
    "ic": 8.5
}
//bdms初始化
window.bdms.init(t)

//构建函数
function get_ab(){
 xhr = new XMLHttpRequest()
    xhr
}